//
//  FunC.h
//  CaiYun
//
//  Created by 今日信息科技 on 2017/6/9.
//  Copyright © 2017年 今日信息科技. All rights reserved.
//

#ifndef FunC_h
#define FunC_h


/*size*/
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(320,MIN(SCREEN_WIDTH, SCREEN_HEIGHT)))
#define STATUS_HEIGHT [[UIApplication sharedApplication] statusBarFrame].size.height
//#define AL_W(x) ([UIScreen mainScreen].bounds.size.width)/320.0*(x)
//#define AL_H(y) ([UIScreen mainScreen].bounds.size.height)/568.0*(y)

/*版本适配size*/
/*自动缩放控件，文字等大小，位置，自动适配所有机型屏幕，（320 568）为当前开发机型的宽高实际数值*/


#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_PAD (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad)

//#define IS_PHONE ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
#define SCALE_WIDTH ([UIScreen mainScreen].bounds.size.width)/320.0
#define SCALE_HEIGHT ([UIScreen mainScreen].bounds.size.height)/568.0
#define AUTO(x) ((SCALE_WIDTH>SCALE_HEIGHT)?(SCALE_HEIGHT*(x)):(SCALE_WIDTH*(x)))
#define AL(x) x
/*end*/
/*end*/

/*color*/
#define RED_COLOR ColorHex(0xf4333c)//主题红
#define THEME_COLOR ColorHex(0x179ffe)//天空蓝
#define ORANGE_COLOR ColorHex(0xff5b05)//醒目橙
#define BLUE_COLOR RGBA(152,253,255,1.0)//冰晶蓝
#define LINE_COLOR ColorHex(0xf5f5f9)//线条银
#define CELL_LINE_COLOR RGBA(230, 230, 230, 1) //cell下划线
#define TEXT_BLACK_COLOR ColorHex(0x333333)//文本黑
#define TEXT_GRAY_COLOR ColorHex(0x888888)//文本灰
#define RGBA(r,g,b,a) [UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:a]
#define ColorHex(s) [UIColor colorWithRed:(((s & 0xFF0000) >> 16))/255.0 green:(((s &0xFF00) >>8))/255.0 blue:((s &0xFF))/255.0 alpha:1.0]

/*end*/

/*func*/

#define WS(type) __weak __typeof(&*type)weakSelf = type;
#define PT(px) (px)/2.0
#ifdef DEBUG
//#define CLog(format, ...)  NSLog(format, ## __VA_ARGS__)
//#define Delog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])
#define DeLog(fmt, ...) NSLog((@"%s \n[第%d行] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)

#else
#define DeLog(...)
/*end*/
#endif

/*判断系统版本*/
#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f)
#define iOS10Later ([UIDevice currentDevice].systemVersion.floatValue >= 10.0f)
/*end*/

/*判断终端类型*/
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
/*end*/

/*判断终端型号*/
#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5_ (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6_7 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P_7P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)
/*end*/


//环信sdk
#define APPKEY_HuanXinSDK @"1410170904061629#kefuchannelapp47030"
#define TENANTID_HuanXinSDK @"47030"
#define IM_ACCOUNT_HuanXinSDK @"kefuchannelimid_298058"

#define SECURITYQUESTION @[@"你的出生地是？",@"你最喜欢的老师是？",@"你最喜欢的电影是？",@"你最想去的地方是？",@"你银行卡密码是？",@"你配偶的生日是？",@"你母亲的生日是？"]

#endif /* FunC_h */


//end
